<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/common/include/page.jsp" %>
<!DOCTYPE HTML>
<html>
	<head>
		<%@ include file="/common/include/header.jsp"%>
		<title>课程管理----更新课程</title>
		<meta name="keywords" content="H-ui.admin v3.1,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
		<meta name="description" content="H-ui.admin v3.1，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
	</head>
	<body>
		<nav class="breadcrumb">
			<span class="c-gray en">&gt;</span> 课程管理
			<span class="c-gray en">&gt;</span> 更新课程
			<a class="btn btn-success radius r" style="line-height: 1.6em; margin-top: 3px"
				href="javascript:location.replace(location.href);" title="刷新">
				<i class="Hui-iconfont">&#xe68f;</i>
			</a>
		</nav>
		<article class="page-container">
			<form class="form form-horizontal" id="form" action="${rootPath}/back/teachers/courseUpdateSubmit">
				<input type="hidden" name="id" value="${requestScope.courses.id }">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>课程名字：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" placeholder="请输入课程名字" name="name" id="name" value="${requestScope.courses.name }">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>课程分数：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" placeholder="请输入课程分数" id="score" name="score" value="${requestScopecourses.score }">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>课程内容：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" placeholder="请输入课程内容" id="content" name="content" value="${requestScope.courses.content }">
					</div>
				</div>
				<div class="row cl">
					<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
						<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
					</div>
				</div>
			</form>
		</article>
		
		<%@ include file="/common/include/footer.jsp"%>
		
		<!--请在下方写此页面业务相关的脚本-->
		<script type="text/javascript" src="${rootPath }/common/resource/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
		<script type="text/javascript" src="${rootPath }/common/resource/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
		<script type="text/javascript" src="${rootPath }/common/resource/lib/jquery.validation/1.14.0/messages_zh.js"></script> 
		<script type="text/javascript">
		$(function(){
			$('.skin-minimal input').iCheck({
				checkboxClass: 'icheckbox-blue',
				radioClass: 'iradio-blue',
				increaseArea: '20%'
			});
			
			/*
				表单验证的框架;
				$();id选择器
			*/
			$("#form").validate({
				/* rules:规则 */
				rules:{
					/* 表单中input的name的值,不是id的值 */
					trueName:{
						/* 必须填写 */
						required:true,
						/* 最小长度 */
						minlength:2,
						/* 最大长度 */
						maxlength:16
					},
					/* 性别必填 */
					sex:{
						required:true,
					},
					/* 性别必填 */
					phone:{
						required:true,
						/* 是手机号;必须是符合要求的手机号 */
						isPhone:true,
					},
					/* 邮箱 */
					email:{
						/* 必须填写 */
						required:true,
						/* 是邮箱 */
						email:true,
					},
					/* 角色 */
					adminRole:{
						required:true,
					},
				},
				onkeyup:false,
				focusCleanup:true,
				success:"valid",
				submitHandler:function(form){
					$(form).ajaxSubmit({
						type: 'post',
						/* url: "${rootPath}/back/AdminsBackServlet?method=adminsInsertSubmit" , */
						success: function(data){
							/**
								参数1:提示信息
								参数2:弹出信息的可选项;time:超时
								参数3:执行完以后调用此方法
							*/
							layer.msg(data.info,{icon:1,time:3000},function()
							{
								/* 成功 */
								if(data.code == '0')
								{
									/* 刷新父窗口 */
									var index = parent.layer.getFrameIndex(window.name);
									parent.$('.btn-refresh').click();
									/* 关闭当前窗口 */
									parent.layer.close(index);
								}
							});
						},
		                error: function(XmlHttpRequest, textStatus, errorThrown){
							layer.msg('error!',{icon:1,time:1000});
						},
						dataType:'json'
					});
				}
			});
		});
		</script> 
		<!--/请在上方写此页面业务相关的脚本-->
	</body>
</html>